'''

Date : 2020/9/29
Time : 10:18

'''
from rest_framework import serializers
from .models import *
from django.contrib.auth.hashers import make_password
class RegisterSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = '__all__'

    def create(self,validated_data):
        validated_data['password'] = make_password(validated_data['password'])
        instance = User.objects.create(**validated_data)
        return instance